/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Cong
 */
@Entity
@Table(name = "doanhthu")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Doanhthu.findAll", query = "SELECT d FROM Doanhthu d"),
    @NamedQuery(name = "Doanhthu.findById", query = "SELECT d FROM Doanhthu d WHERE d.id = :id"),
    @NamedQuery(name = "Doanhthu.findByLoai", query = "SELECT d FROM Doanhthu d WHERE d.loai = :loai"),
    @NamedQuery(name = "Doanhthu.findByTongdoanhthu", query = "SELECT d FROM Doanhthu d WHERE d.tongdoanhthu = :tongdoanhthu"),
    @NamedQuery(name = "Doanhthu.findByNgay", query = "SELECT d FROM Doanhthu d WHERE d.ngay = :ngay")})
public class Doanhthu implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id")
    private Long id;
    @Basic(optional = false)
    @Column(name = "loai")
    private long loai;
    @Basic(optional = false)
    @Column(name = "tongdoanhthu")
    private double tongdoanhthu;
    @Basic(optional = false)
    @Column(name = "ngay")
    @Temporal(TemporalType.TIMESTAMP)
    private Date ngay;
    @JoinColumn(name = "id_cuahang", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Cuahang idCuahang;

    public Doanhthu() {
    }

    public Doanhthu(Long id) {
        this.id = id;
    }

    public Doanhthu(Long id, long loai, double tongdoanhthu, Date ngay) {
        this.id = id;
        this.loai = loai;
        this.tongdoanhthu = tongdoanhthu;
        this.ngay = ngay;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public long getLoai() {
        return loai;
    }

    public void setLoai(long loai) {
        this.loai = loai;
    }

    public double getTongdoanhthu() {
        return tongdoanhthu;
    }

    public void setTongdoanhthu(double tongdoanhthu) {
        this.tongdoanhthu = tongdoanhthu;
    }

    public Date getNgay() {
        return ngay;
    }

    public void setNgay(Date ngay) {
        this.ngay = ngay;
    }

    public Cuahang getIdCuahang() {
        return idCuahang;
    }

    public void setIdCuahang(Cuahang idCuahang) {
        this.idCuahang = idCuahang;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Doanhthu)) {
            return false;
        }
        Doanhthu other = (Doanhthu) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "gui.Doanhthu[ id=" + id + " ]";
    }
    
}
